using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq.Mapping;
using System.Data.Linq;
using System.ComponentModel;

namespace MRSite.Entity
{
    [Table(Name = "product")]
    public class Product : Entity
    {
        /// <summary>
        ///自增ID
        /// </summary>
        [Column(Name = "id", IsPrimaryKey = true, CanBeNull = false, IsVersion = true)]
        public override int id { get; set; }

        /// <summary>
        ///标题
        /// </summary>
        [Column(Name = "title")]
        public String title { get; set; }

        /// <summary>
        /// 自己店铺类别ID
        /// </summary>
        [Column(Name = "category_id")]
        public int category_id { get; set; }

        
        /// <summary>
        /// 总平台分类ID
        /// </summary>
        [Column(Name = "type_id")]
        public int type_id { get; set; }
        

        /// <summary>
        ///是否上架销售
        /// </summary>
        [Column(Name = "upselling")]
        public int upselling { get; set; }

        /// <summary>r
        ///点击量
        /// </summary>
        [Column(Name = "hits")]
        public int hits { get; set; }

        /// <summary>
        ///排序 数字越大越靠前
        /// </summary>
        [Column(Name = "sort_id")]
        public int sort_id { get; set; }

        /// <summary>
        ///外部链接
        /// </summary>
        [Column(Name = "link_url")]
        public String link_url { get; set; }

        /// <summary>
        ///图片地址
        /// </summary>
        [Column(Name = "img_url")]
        public String img_url { get; set; }

        /// <summary>
        ///
        /// </summary>
        [Column(Name = "seo_title")]
        public String seo_title { get; set; }

        /// <summary>
        ///
        /// </summary>
        [Column(Name = "seo_keywords")]
        public String seo_keywords { get; set; }

        /// <summary>
        ///
        /// </summary>
        [Column(Name = "seo_description")]
        public String seo_description { get; set; }

        /// <summary>
        /// 副标题 内容摘要
        /// </summary>
        [Column(Name = "zhaiyao")]
        public String zhaiyao { get; set; }

        /// <summary>
        ///内容
        /// </summary>
        [Column(Name = "contents")]
        public String contents { get; set; }

        /// <summary>
        ///最新
        /// </summary>
        [Column(Name = "is_new")]
        public int is_new { get; set; }

        /// <summary>
        ///是否热卖
        /// </summary>
        [Column(Name = "is_hot")]
        public int is_hot { get; set; }

        /// <summary>
        ///是否可以评论
        /// </summary>
        [Column(Name = "is_msg")]
        public int is_msg { get; set; }

        /// <summary>
        ///是否推荐
        /// </summary>
        [Column(Name = "is_red")]
        public int is_red { get; set; }

        /// <summary>
        ///是否特价
        /// </summary>
        [Column(Name = "is_spec")]
        public int is_spec { get; set; }


        /// <summary>
        ///标签
        /// </summary>
        [Column(Name = "tags")]
        public String tags { get; set; }

        /// <summary>
        ///
        /// </summary>
        [Column(Name = "add_time", IsDbGenerated = true)]
        public DateTime add_time { get; set; }

        /// <summary>
        ///频道ID(0:自营商城；1：个人店；2：企业店；)
        /// </summary>
        [Column(Name = "channel_id")]
        public int channel_id { get; set; }

        ///// <summary>
        /////用户名
        ///// </summary>
        //[Column(Name = "user_name")]
        //public string user_name { get; set; }

        /// <summary>
        ///视频地址
        /// </summary>
        [Column(Name = "video_src")]
        public String video_src { get; set; }



        /// <summary>
        ///商品货号
        /// </summary>
        [Column(Name = "item_no")]
        public String item_no { get; set; }

        /// <summary>
        ///库存
        /// </summary>
        [Column(Name = "stock_quantity"), DefaultValue(0)]
        public int stock_quantity { get; set; }

        /// <summary>
        /// 市场价
        /// </summary>
        [Column(Name = "market_price")]
        public Decimal market_price { get; set; }

        /// <summary>
        ///销售价
        /// </summary>
        [Column(Name = "sell_price")]
        public Decimal sell_price { get; set; }

        /// <summary>
        ///赠送积分
        /// </summary>
        [Column(Name = "point"), DefaultValue(0)]
        public int point { get; set; }

        /// <summary>
        ///购买所需积分
        /// </summary>
        [Column(Name = "sell_point"), DefaultValue(0)]
        public int sell_point { get; set; }

        /// <summary>
        ///成本价
        /// </summary>
        [Column(Name = "cost_price")]
        public Decimal cost_price { get; set; }

         /// <summary>
        /// 进货价
        /// </summary>
        [Column(Name = "jinhuo_price")]
        public Decimal jinhuo_price { get; set; }

        

        /// <summary>
        /// PV值，用来给奖励
        /// </summary>
        [Column(Name = "PV")]
        public Decimal PV { get; set; }


        /// <summary>
        ///销售量
        /// </summary>
        [Column(Name = "sales_volume"), DefaultValue(0)]
        public int sales_volume { get; set; }

        /// <summary>
        ///单次最大购买量(0为不限制)
        /// </summary>
        [Column(Name = "maxbuy"), DefaultValue(0)]
        public int maxbuy { get; set; }

       
        /// <summary>
        ///用户最多购买量(0为不限制)
        /// </summary>
        [Column(Name = "usermaxbuy"), DefaultValue(0)]
        public int usermaxbuy { get; set; }

        ///// <summary>
        /////是否开启分佣
        ///// </summary>
        //[Column(Name = "hascommission"), DefaultValue(0)]
        //public int hascommission { get; set; }


        ///// <summary>
        /////上一级分佣百分比
        ///// </summary>
        //[Column(Name = "commission1_rate"), DefaultValue(0)]
        //public Decimal commission1_rate { get; set; }

        ///// <summary>
        /////上一级分佣固定金额
        ///// </summary>
        //[Column(Name = "commission1_pay"), DefaultValue(0)]
        //public Decimal commission1_pay { get; set; }

        ///// <summary>
        /////上二级分佣百分比
        ///// </summary>
        //[Column(Name = "commission2_rate"), DefaultValue(0)]
        //public Decimal commission2_rate { get; set; }

        ///// <summary>
        /////上二级分佣固定金额
        ///// </summary>
        //[Column(Name = "commission2_pay"), DefaultValue(0)]
        //public Decimal commission2_pay { get; set; }

        ///// <summary>
        /////上三级分佣百分比
        ///// </summary>
        //[Column(Name = "commission3_rate"), DefaultValue(0)]
        //public Decimal commission3_rate { get; set; }

        ///// <summary>
        /////上三级分佣固定金额
        ///// </summary>
        //[Column(Name = "commission3_pay"), DefaultValue(0)]
        //public Decimal commission3_pay { get; set; }

        /// <summary>
        ///重量
        /// </summary>
        [Column(Name = "weight")]
        public Decimal weight { get; set; }

        //    /// <summary>
        ///// 开售时间
        ///// </summary>
        //[Column(Name = "ys_time")]
        //public DateTime? ys_time { get; set; }

        // /// <summary>
        ///// 锁仓天数
        ///// </summary>
        //[Column(Name = "days")]
        //public int days { get; set; }

        ///// <summary>
        ///// 配额的倍数
        ///// </summary>
        //[Column(Name = "beishu")]
        //public decimal beishu { get; set; }
        
        // /// <summary>
        ///// 节点定制量(件)
        ///// </summary>
        //[Column(Name = "jiedianN")]
        //public int jiedianN { get; set; }

        ///// <summary>
        /////预设件数(件)
        ///// </summary>
        //[Column(Name = "yushejian")]
        //public int yushejian { get; set; }


        /// <summary>
        /// 开团时间(小时)
        /// </summary>
        [Column(Name = "hour"), DefaultValue(0)]
        public int hour { get; set; }


        /// <summary>
        ///是否参与拼团
        /// </summary>
        [Column(Name = "IsGroup")]
        public int IsGroup { get; set; }

        // /// <summary>
        ///// GAB释放百分比
        ///// </summary>
        //[Column(Name = "GAB_per"), DefaultValue(0)]
        //public Decimal GAB_per { get; set; }

        ///// <summary>
        ///// BAB释放百分比
        ///// </summary>
        //[Column(Name = "BAB_per"), DefaultValue(0)]
        //public Decimal BAB_per { get; set; }

        ///// <summary>
        ///// 折返包 官方红包释放百分比
        ///// </summary>
        //[Column(Name = "GfHongbao_per"), DefaultValue(0)]
        //public Decimal GfHongbao_per { get; set; }

         /// <summary>
        /// 多个分类
        /// </summary>
        [Column(Name = "product_type")]
        public String product_type { get; set; }

        /// <summary>
        /// 店铺id
        /// </summary>
        [Column(Name = "shopid"), DefaultValue(0)]
        public int shopid { get; set; }

        /// <summary>
        /// 店铺设置的优惠红包
        /// </summary>
        [Column(Name = "hongbao")]
        public Decimal hongbao { get; set; }

           /// <summary>
        /// 店铺设置的赠送贡献值
        /// </summary>
        [Column(Name = "score")]
        public Decimal score { get; set; }
        
      
        /// <summary>
        /// 首购奖励 赠送红包
        /// </summary>
        [Column(Name = "hongbao_first")]
        public Decimal hongbao_first { get; set; }

        /// <summary>
        /// 首购奖励 赠送贡献值
        /// </summary>
        [Column(Name = "score_first")]
        public Decimal score_first { get; set; }

          /// <summary>
        /// 是否包邮
        /// </summary>
        [Column(Name = "Isfree"), DefaultValue(0)]
        public int Isfree { get; set; }

        /// <summary>
        /// 运费模板
        /// </summary>
        [Column(Name = "express_id"), DefaultValue(0)]
        public int express_id { get; set; }

         /// <summary>
        /// 状态 0：未审核；1：审核通过
        /// </summary>
        [Column(Name = "status"), DefaultValue(0)]
        public int status { get; set; }

        /// <summary>
        /// 是否有规格
        /// </summary>
        [Column(Name = "hasoption"), DefaultValue(0)]
        public int hasoption { get; set; }
        
        

        //private EntityRef<Customer> _member;
        //[Association(OtherKey = "username", Storage = "_member", ThisKey = "user_name")]
        //public Customer CustomerItem
        //{
        //    get
        //    {
        //        return this._member.Entity;
        //    }
        //    set
        //    {
        //        this._member.Entity = value;
        //    }
        //}

        private EntityRef<ProductCategory> _productCategory;
        /// <summary>
        /// 商品类别,外键
        /// </summary>
        [Association(Storage = "_productCategory", ThisKey = "category_id", OtherKey = "id")]
        public ProductCategory ProductCategoryItem
        {
            get { return this._productCategory.Entity; }
            set { this._productCategory.Entity = value; }
        }





        private EntitySet<ProductAlbums> _productAlbumsList;
        /// <summary>
        /// 相册
        /// </summary>
        [Association(Storage = "_productAlbumsList", ThisKey = "id", OtherKey = "product_id")]
        public EntitySet<ProductAlbums> ProductAlbumsList
        {
            get { return this._productAlbumsList; }
            set { this._productAlbumsList.Assign(value); }
        }

        private EntitySet<ProductComment> _productCommentList;
        /// <summary>
        /// 评论，主键
        /// </summary>
        [Association(Storage = "_productCommentList", ThisKey = "id", OtherKey = "product_id")]
        public EntitySet<ProductComment> ProductCommentList
        {
            get { return this._productCommentList; }
            set { this._productCommentList.Assign(value); }
        }

        private EntitySet<ProductSku> _productSkuList;
        /// <summary>
        /// 商品SKU，主键
        /// </summary>
        [Association(Storage = "_productSkuList", ThisKey = "id", OtherKey = "product_id")]
        public EntitySet<ProductSku> ProductSkuList
        {
            get { return this._productSkuList; }
            set { this._productSkuList.Assign(value); }
        }

        private EntitySet<CustomerGroupPrice> _groupPriceList;
        /// <summary>
        /// 会员组价格，主键
        /// </summary>
        [Association(Storage = "_groupPriceList", ThisKey = "id", OtherKey = "product_id")]
        public EntitySet<CustomerGroupPrice> GroupPriceList
        {
            get { return this._groupPriceList; }
            set { this._groupPriceList.Assign(value); }
        }
        

       

        public Product()
        {
            this._productAlbumsList = new EntitySet<ProductAlbums>();
            this._productCommentList = new EntitySet<ProductComment>();
            this._productSkuList = new EntitySet<ProductSku>();
            this._groupPriceList = new EntitySet<CustomerGroupPrice>();

           
        }
    }
}

